<template>
  <footer class="footer">
    <span class="todo-count"
      >剩余<strong>数量值{{ length }}</strong></span
    >
    <ul class="filters">
      <li>
        <a
          @click="changeType('all')"
          :class="{ selected: type === 'all' }"
          href="javascript:;"
          >全部</a
        >
      </li>
      <li>
        <a
          @click="changeType('active')"
          :class="{ selected: type === 'active' }"
          href="javascript:;"
          >未完成</a
        >
      </li>
      <li>
        <a
          @click="changeType('complete')"
          :class="{ selected: type === 'complete' }"
          href="javascript:;"
          >已完成</a
        >
      </li>
    </ul>
    <button @click="claerAsync" v-show="isShow" class="clear-completed">
      清除已完成
    </button>
  </footer>
</template>

<script>
import { mapActions, mapGetters, mapMutations, mapState } from "vuex";
export default {
  computed: {
    ...mapState("todo", ["type"]),
    ...mapGetters("todo", ["length", "isShow"]),
  },
  methods: {
    ...mapActions("todo", ["claerAsync"]),
    ...mapMutations("todo", ["changeType"]),
  },
};
</script>
